﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AdminSite.Master" AutoEventWireup="true" CodeBehind="AdminMenu.aspx.cs" Inherits="Agents.AdminMenu" %>
<%@ Import Namespace="Agents.Data" %>

<asp:Content ID="Header" ContentPlaceHolderID="Header" runat="server">
	<script type="text/javascript">

		// Show the notification details by its Id
		function showNotificationDetails(notificationId) {

			PopupCenter('NotificationDetails.aspx?notificationId=' + notificationId, 'מערכת סוכנים', 420, 220, true);
		}
	</script>
	<script src="../Scripts/Common.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">

	<asp:Panel ID="pnlUpdates" runat="server" Font-Names="Verdana" GroupingText="עדכונים אחרונים"
				CssClass="panel">
		<asp:Label ID="lblUpdates" runat="server" Text="עדיין לא ממומש..." Height="120px" />
	</asp:Panel>

	<asp:Panel ID="pnlNotifications" runat="server" Font-Names="Verdana" GroupingText="התראות אחרונות">
		<asp:DataList ID="grdNotifications" runat="server" DataSourceID="SqlDataSource1" AutoGenerateColumns="false"
					  GridLines="None" RepeatDirection="Vertical" RepeatColumns="4">
			<ItemTemplate>
				<div style="background-image: url('../images/stickyNotepad.jpg'); height:120px;width:135px;
					background-repeat:no-repeat;background-position:center" >     
					<asp:TextBox ID="lblNotificationTitle" runat="server" CssClass="paddedTextbox"
						ReadOnly="true" BorderStyle="None" Wrap="true" Rows="3" Columns="12"
						BackColor="Transparent" Font-Names="Verdana"  TextMode="MultiLine" 
						ForeColor="Navy" Font-Bold="true" 
						Text='<%# Eval("Name", "התראה על המוצר {0}:") %>'></asp:TextBox>

					<asp:TextBox ID="lblNotificationDetails" runat="server" CssClass="paddedTextbox"
						ReadOnly="true" BorderStyle="None" Wrap="true" Rows="1" Columns="12"
						BackColor="Transparent" Font-Names="Verdana"  TextMode="MultiLine" 
						Text='<%# (Int32.Parse(Eval("NotificationType").ToString()) == (int)NotificationTypes.LACK_NOTIFICATION) ? "המוצר חסר במלאי" : "מלאי מת" %>'>
					</asp:TextBox>

					<asp:HyperLink Text="פרטי ההתראה" runat="server" ID="lnkNotificationDetails" Font-Names="Verdana"
						Font-Size="Small" CssClass="paddedTextbox"
						NavigateUrl='<%# Eval("NotificationId", "javascript:showNotificationDetails({0})") %>'>
					</asp:HyperLink>
				</div> 
			</ItemTemplate>
		</asp:DataList>

		<asp:HyperLink Text="לכל ההתראות..." runat="server" ID="lnkNotifications" Font-Names="Verdana"
			Font-Size="Small" NavigateUrl="~/Admin/NotificationsPage.aspx" CssClass="alignLeft">
		</asp:HyperLink>

		<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
			ConnectionString="<%$ ConnectionStrings:AgentConnectionString %>" 
			SelectCommand="SELECT TOP 8 Notifications.Id AS NotificationId, Products.Id AS ProductId, Products.Name, 
									Products.ItemsInStock, Products.Threshold, Notifications.Date, NotificationType
							FROM Notifications LEFT JOIN Products
							ON (Notifications.ProductId = Products.Id)  
							ORDER BY Date DESC">
		</asp:SqlDataSource>
	</asp:Panel>
</asp:Content>

